/**
    Copyright (c) 2010 yakiimo02
    Distributed under the New BSD License.
    See included license.txt or http://www.yakiimo3d.com/NewBSDLicense.txt
**/

#pragma once

#include "DataBuffer.h"

/**    
    @brief  Holds GPU output buffer interfaces.
    @author yakiimo02
    @date    2010/01/30
*/
class DataBufferDX11 : public DataBuffer
{
public:
    DataBufferDX11();
    ~DataBufferDX11();

    HRESULT OnResizedSwapChain( ID3D11Device* pd3dDevice, const DXGI_SURFACE_DESC* pBackBufferSurfaceDesc );
    void    Destroy();
    void    UpdateBuffer( ID3D11Device* pd3dDevice, ID3D11DeviceContext* pd3dImmediateContext );

    inline ID3D11ShaderResourceView*    GetpSRVGPU() { return m_pSRVGPU; }
    inline ID3D11ShaderResourceView*    GetpSRVCPU() { return m_pSRVCPU; }
    inline ID3D11Buffer*                GetpBufferGPU() { return m_pBufferGPU; }
    inline ID3D11Buffer*                GetpBufferCPU() { return m_pBufferCPU; }

protected:
    HRESULT Create( ID3D11Device* pd3dDevice, int nWidth, int nHeight );

protected:
    ID3D11Buffer*                m_pBufferGPU;        // structured buffer for the gpu
    ID3D11Buffer*                m_pBufferCPU;        // structured buffer for the cpu
    ID3D11ShaderResourceView*   m_pSRVCPU;            // srv for cpu
    ID3D11ShaderResourceView*   m_pSRVGPU;            // srv for gpu
};

